home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
vmap.arc
/
VMAP.BAS
next >
Wrap
BASIC Source File
|
1980-01-03
|
7KB
|
173 lines
10 'VMAP.BAS VERSION 1.0
11 '
12 '
13 '
14 '--------------------------------------------------------------
20 'BATCH BUILD SEGMENT, 07/26/81, JWC
30 '
40 '
50 CL$=CHR$(30)+CHR$(27)+CHR$(89)'CLEAR SCREEN CODE FOR ACTRIX COMPUTER
60 FF$=CHR$(12)'FORMFEED CODE FOR CENTRONICS PRINTERS
70 '
80 '
90 PRINT CL$
100 INPUT "PROCESS LAST SETUP (Y/N) ";TI$:IF TI$="Y" THEN GOTO 170
105 PRINT
110 OPEN "O",#1,"A:VARDAT"
120 INPUT"FILE NAME, TERMINATOR, LOWER BOUND, UPPER BOUND ";PN$,TI$,LB!,UB!
130 PRINT#1,CHR$(34);PN$;CHR$(34);CHR$(34);TI$;CHR$(34);LB!,UB!
140 IF TI$="END" THEN GOTO 160
150 GOTO 120
160 CLOSE 1
161 '
162 '
163 '----------------------------------------------------
170 'MAPPING SEGMENT FOR BASIC FILES, 07/27/81, JWC
171 '
172 '
180 PRINT CL$:WIDTH 80:LC=0:DR%=0
190 OPEN"I",2,"A:VARDAT"
200 PRINT:PRINT:PRINT"ONE MOMENT FOR SETUP PLEASE.......":PRINT
210 INPUT"DO YOU WANT A PRINT OUT (Y/N) ";PO$
220 IF PO$="Y" THEN PT$="P" ELSE PT$="N"
230 NX=80'MAX NUMBER OF VARIABLE CAPACITY
240 DIM V$(NX),NL%(NX),LL%(NX,NX-10),PA%(NX)
250 FOR I=1 TO NX:PA%(I)=I:NEXT I
260 READ NK:DIM K$(NK):DEF FN A$(A)=MID$(STR$(A),2)
270 FOR I=1 TO NK:READ K$(I):NEXT I
280 INPUT#2,PN$,I1$,LB!,UB!
290 PN$="A:"+PN$+".BAS"
300 OPEN"I",1,PN$
310 PRINT:PRINT"*** LINES BEING PROCESSED:":
320 IF EOF(1) THEN 360
330 S=0:H=0:O=0:IN%=0:Q=0:LINE INPUT#1,L$
340 GOSUB 740
350 IF N+32767!<UB! GOTO 320
360 PRINT:PRINT:PRINT"SORTING VARIABLES....... "
370 GOSUB 1160
380 IF PT$="P" THEN GOTO 530 ELSE PRINT:PRINT:INPUT"HIT RETURN WHEN READY FOR LISTING ON CRT ";I$
390 PRINT:PRINT:PRINT"LIST OF VARIABLES FOR PROGRAM ";PN$:PRINT
400 FOR I=1 TO NF
410 PRINT V$(I);TAB(15);"-";
420 FOR J=0 TO NL%(PA%(I))-1:IF J>0 THEN PRINT", ";
430 PRINT FNA$(LL%(PA%(I),J)+32767!);
440 NEXT J
450 PRINT:PRINT:NEXT I
460 GOTO 630
470 CLOSE 1
480 IF I1$="K" THEN PRINT"KILL '";PN$;"',";DR%:KILL PN$,DR%
490 IF I1$="P" THEN 530
500 IF I1$="C" THEN 180
510 IF I1$<>"END" THEN RUN
520 CLOSE 2:PRINT:PRINT"*** END OF VARIABLE MAP PROGRAM ***":END
530 GOSUB 1250:LPRINT TAB(50);"LINES";NL+32767!;"TO";N+32767!:LPRINT:LC=LC+2
540 FOR I=1 TO NF:LPRINT STR$(I);".";TAB(6);V$(I);TAB(15);"-";:C=0
550 FOR J=0 TO NL%(PA%(I))-1:IF C THEN LPRINT", ";:ELSE C=-1
560 IF JMOD13=12 THEN LPRINT:LC=LC+1:LPRINT TAB(15);"-";
570 LPRINT FNA$(LL%(PA%(I),J)+32767!);
580 NEXT J
590 LPRINT:LPRINT:LC=LC+2
600 IF LC>60 THEN GOSUB 1240:GOSUB 1250:LPRINT:LC=LC+1
610 NEXT I
620 IF LC>50 THEN GOSUB 1240:GOSUB 1250:LPRINT:LC=LC+1
630 IF PT$="P" THEN LPRINT:LPRINT"EQUIVALENT VARIABLES":LC=LC+3
640 V$="$(!(#(%("
650 FOR I=0 TO NF-1:FOR J=I+1 TO NF-1
660 IF LEFT$(V$(I),2)<>LEFT$(V$(J),2) OR LEFT$(V$(I),2)="FN" THEN 700
670 ON ERROR GOTO 1390
680 IF(INSTR(V$,RIGHT$(V$(I),2))<>INSTR(V$,RIGHT$(V$(J),2))) OR (INSTR(V$(RIGHT$(V$(I),1))<>INSTR(V$(RIGHT$(V$(J),1))) THEN 700
690 IF PT$="P" THEN GOSUB 990:LPRINT V$(I);"=";V$(J) ELSE LPRINTV$(I);"=";V$(J):LC=LC+1:EF%=-1
700 NEXT J:NEXT I
710 IF NOT EF% THEN IF PT$="P" THEN LPRINT"** NONE FOUND **":LC=LC+1
720 IF PT$="P" THEN GOSUB 1240
730 GOTO 470
731 '
732 '
733 '
734 '-------------------------------------------------------------
735 'VARIABLE SEARCH SUBROUTINE
736 '
737 '
740 R=0:V=0:X=INSTR(L$," "):N=VAL(LEFT$(L$,X))-32767!:S$=MID$(L$,X+1)
750 IF N+32767!>UB! THEN RETURN
760 IF N+32767!<LB! THEN RETURN ELSE PRINT:PRINT L$:PRINT TAB(5);:IF NOT XN% THEN XN%=-1:NL=N
770 IF LEFT$(S$,1)=" " THEN S$=MID$(S$,2):GOTO 770
780 IF INSTR(S$,"DATA")=1 THEN RETURN
790 FOR I=1 TO LEN(S$)
800 X$=MID$(S$,I,1):X=ASC(X$)
810 IF NOT S THEN 860
820 IF H THEN IF(X=>48 AND X<=57) OR (X=>65 AND X<=70) THEN 950 ELSE H=0:S=0:GOTO 860
830 IF O THEN IF(X=>48 AND X<=57) THEN 950 ELSE O=0:S=0:GOTO 860
840 IF X=72 AND NOT H THEN H=-1:GOTO 950
850 IF X=79 AND NOT O THEN O=-1:GOTO 950 ELSE S=0:H=0:O=0
860 IF X=34 THEN IF Q THEN Q=0:V$="":GOTO 950 ELSE Q=-1:GOTO 950
870 IF Q THEN 950
880 IF X=39 THEN RETURN 'REMARK
890 IF X=38 THEN S=-1:GOTO 950
900 IF (X=>48 AND X<=57) OR (X=>65 AND X<=90) OR (X=35 OR X=33 OR X=36 OR X=37) THEN IF V THEN V$=V$+X$:GOTO 950 ELSE V$=X$:V=-1:GOTO 950
910 IF X=40 AND V THEN V$=V$+X$
920 IF NOT V THEN 950
930 GOSUB 960:V=0
940 IF R THEN RETURN
950 NEXT I:IF NOT V THEN RETURN
951 '
952 '
953 '
954 '------------------------------------------------------
955 'KEYWORD COMPARE SUBROUTINE
956 '
957 '
960 IF V$="REM" OR V$="DATA" THEN R=-1:RETURN'SUB ---- 20000
970 IF VAL(V$)<>0 OR LEFT$(V$,1)="0" THEN V$=MID$(V$,2):GOTO 970
980 FOR J=1 TO NK:Y=INSTR(V$,K$(J)):IF Y=0 THEN 1030
990 IF V$=K$(J) THEN RETURN 'KEY WORD
1000 IF LEFT$(V$,LEN(K$(J)))=K$(J) THEN V$=MID$(V$,LEN(K$(J))+1):GOTO 960
1010 IF RIGHT$(V$,LEN(K$(J)))=K$(J) THEN V$=MID$(V$,1,LEN(V$)-LEN(K$(J))):GOTO 960
1020 VH$=MID$(V$,Y+LEN(K$(J))):V$=LEFT$(V$,Y-1):GOSUB 960:IF R THEN RETURN ELSE V$=VH$:GOTO 960
1030 NEXT J
1040 IF V$="(" OR V$="" OR V$="!" OR V$="%" OR V$="#" THEN RETURN
1050 IF IN% THEN PRINT";";:ELSE IN%=-1
1060 IF NF=0 THEN 1130
1070 FOR J=0 TO NF
1080 IF V$<>V$(J) THEN 1110
1090 IF LL%(J,NL%(J)-1)=N THEN RETURN
1100 IF NL%(J)<80 THEN LL%(J,NL%(J))=N:NL%(J)=NL%(J)+1:PRINT V$;",<";FNA$(NL%(J));">";:RETURN
1110 NEXT J
1120 IF NF=NX-1 THEN PRINT:PRINT"OUT OF ROOM FOR VARIABLES, CONTINUE NEXT RUN...":GOTO 360
1130 PRINT V$;",[";FNA$(NF+1);"]";
1140 V$(NF)=V$:LL%(NF,NL%(NF))=N:NL%(NF)=NL%(NF)+1:NF=NF+1
1150 RETURN
1151 '
1152 '
1153 '
1154 '-----------------------------------------------------------
1155 'SORT SUBROUTINE
1156 '
1157 '
1160 DIM H(9):H(1)=1:H(2)=4:H(3)=13:T=1
1170 IF H(T+2)<5000 THEN T=T+1:H(T+2)=3*H(T+1)+1:GOTO 1170
1180 IF NF=0 THEN RETURN ELSE FOR T=1 TO 6:IF H(T+2)<NF THEN NEXT
1190 FOR S=T TO 1 STEP-1:H=H(S):FOR JJ=H TO NF
1200 V$=V$(JJ):PA%=PA%(JJ):FOR II=JJ-H TO 0 STEP-H
1210 IF V$<V$(II) THEN V$(II+H)=V$(II):PA%(II+H)=PA%(II):NEXT
1220 V$(II+H)=V$:PA%(II+H)=PA%:NEXT JJ,S
1230 RETURN
1240 FOR IK=LC TO 65:LPRINT:NEXT IK:LC=0:RETURN
1250 LPRINT FF$:LPRINT:LPRINT:LPRINT"LIST OF VARIABLES FOR PROGRAM ";PN$;:LC=LC+3:RETURN
1260 DATA 116
1270 DATA CONSOLE,RESTORE,SPACE$(,UNLOAD
1280 DATA LPRINT,DEFDBL,DEFINT,DEFSNG,DEFSTR,DELETE,RESUME,RETURN,RIGHT$
1290 DATA PRINT,LLIST,INPUT,CLEAR,CLOAD,CLOSE,CSAVE,DSKI$,DSKO$,ERASE
1300 DATA ERROR,FIELD,FILES,GOSUB,INSTR,LEFT$,MERGE,MOUNT,TROFF,USING
1310 DATA TRON,CDBL,CHR$,CINT,CONT,CSNG,DSKF,EDIT,ELSE,GOTO,KILL,LINE
1320 DATA LIST,LOAD,LPOS,LSET,MID$,MKD$,MKI$,MKS$,NAME,NEXT,NULL,OPEN
1330 DATA PEEK,POKE,READ,RSET,SAVE,SPC,(,STEP,STOP,STR$,SWAP,TAB(,THEN,WAIT
1340 DATA ABS,AND,ASC,ATN,COS,CVD,CVI,CVS,DEF,DIM,END,EOF,ERL,ERR,EXP,FOR
1350 DATA FRE,GET,INP,INT,LEN,LET,LOC,LOF,LOG,MOD,NEW,NOT,OUT,POS,PUT,RND
1360 DATA RUN,SGN,SIN,SQR,TAN,USR,BAL
1370 DATA AS,IF,TO,ON,OR
1380 DATA WIDTH,TAB
1390 IF ERR=13 THEN PRINT:PRINT:PRINT"**** NO VARIABLES FOUND *****":PRINT:GOTO 470
1400 PRINT"ERROR CODE IS ";ERR;" ON LINE NUMBER ";ERL;:PRINT:END
T:PRINT:PRINT"**** NO VARIABLES FOUND *****":PRINT:GOTO 470
1400 PR